/**
 * Created with IntelliJ IDEA.
 * User: zdc
 * Date: 12-11-20
 * Time: 下午9:21
 * To change this template use File | Settings | File Templates.
 */

fl.runScript(fl.configURI + "jsfl/core.jsfl");

function writePng(pixels){
    var f = fll();                  //fl.trace(pixels);return;
    var s = stk();
    var d = dom();
    s.thickness = 1;
    s.style = "solid";
    var w = pixels.length;
    d.addNewRectangle({left: 0, top: 0, right: pixels.length, bottom: pixels[0].length}, 0, false, true);
    var i, j, h;
    var rect = {left: 0, top: 0, right: 0, bottom: 0};
    for(i = 0; i < w; i++){
        h = pixels[i];
        var hl = h.length;
        for(j = 0; j < hl; j++){
            var c = h[j];
            rect.left = i;
            rect.right = (i + 1);
            rect.top = j;
            rect.bottom = (j + 1);
            if(c.substr(7) != '00' && c.substr(7) != ''){
                f.color = c;
                d.setCustomFill(f);
                d.addNewRectangle(rect, 0, false, true);
            }
        }
    }

//    alert(pixels.length + ',' + pixels[0].length);
}

var s = '#0000001'
alert(s.substr(7).toString(10));